// @ts-nocheck
export function regExpLeadsToEndlessLoop(regexp: RegExp): boolean {
  // Exit early if it's one of these special cases which are meant to match
  // against an empty string
  if (
    regexp.source === "^" ||
    regexp.source === "^$" ||
    regexp.source === "$" ||
    regexp.source === "^\\s*$"
  ) {
    return false
  }

  // We check against an empty string. If the regular expression doesn't advance
  // (e.g. ends in an endless loop) it will match an empty string.
  const match = regexp.exec("")
  return !!(match && regexp.lastIndex === 0)
}


